package com.example.user.controller;

import com.example.user.entity.User;
import com.example.user.common.Result;
import com.example.user.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@CrossOrigin(origins = "http://localhost:8080")
public class UserInfoController {


    @Autowired
    private UserInfoService userService;


    /**
     * 注册接口
     */


    @PostMapping("/register")
    public Result register(@RequestBody User user)
    {

       Result result= userService.register(user);
       return result;

    }

    /**
     * 登录接口
     */

    @PostMapping("/login")
    public Result login(@RequestBody User user)
    {
       Result result= userService.login(user);
       return result;
    }



}
